package com.colin.userservice9001.controller;

import cn.dev33.satoken.stp.SaTokenInfo;
import com.colin.common.bean.User;
import com.colin.common.response.R;
import com.colin.userservice9001.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * 登录接口
     * @param user 用户信息
     *             username
     *             password
     * @return R
     *         data: SaTokenInfo
     */
    @PostMapping("/user")
    public R<SaTokenInfo> login(@RequestBody User user) {
        return userService.login(user);
    }
}
